Mapping every second item
I wanted to apply a function to every second item in a coll. I was considering writing something using interleave
, take-nth
and map
or a combination of mapcat
and partition
when I thought of this:
(map #(%1 %2) (cycle [f identity]) coll)
I really love clojure’s map parallel processing. (I should ask if every?
and some
could be allowed to take several colls.)